<?php
/*
Chương trình: "Quản lý Hóa Đơn và in hóa đơn Trường Thành"
Tác giả: "Lê Phương"
Phiên bản: "1.0"
Tệp tin: "print.tpl.php"
*/
if(defined("template")!=true){
	die('Template not found!');
}
if($paper_type == 'A4'){
	$pdf->AddPage('P', 'A4');
	$pdf->SetFont('freeserif', 'B', 13);
	if($form == ''){
		$form_print = '';
	}
	else{
		$form_print = '                                                  Mẫu số: '.$form;
	}
	if($form == ''){
		$serial_print = '';
	}
	else{
		$serial_print = '                                                  Ký hiệu: '.$serial;
	}
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->SetFont('freeserif', 'B', 16);
	$pdf->Write(0, $name, '', 0, 'C', true, 0, false, false, 0);
	$pdf->SetFont('freeserif', 'B', 13);
	$pdf->Write(0, 'Mã số thuế: '.$tax, '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, 'Địa chỉ: '.$address, '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, $form_print, '', 0, 'L', true, 0, false, false, 0);
	$pdf->Write(0, $serial_print, '', 0, 'L', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, '                                                  Quyển số: '.$i, '', 0, 'L', true, 0, false, false, 0);
	$pdf->Write(0, '', '', 0, 'C', true, 0, false, false, 0);
	$pdf->Write(0, 'Từ số: '.$sotruoc.'                                Đến số: '.$sosau, '', 0, 'C', true, 0, false, false, 0);
}
else{
	$pdf->AddPage('P', 'A4');
	$pdf->SetFont('freeserif', 'B', 12);
	$space2 = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	if($form == ''){
		$form_print = '';
	}
	else{
		$form_print = $space2.'Mẫu số: '.$serial;
	}
	if($form == ''){
		$serial_print = '';
	}
	else{
		$serial_print = $space2.'Ký hiệu: '.$serial;
	}
	$html = '&nbsp;&nbsp;&nbsp;<table border="0" style="height:140mm;width:160mm">
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7" height="11mm">'.$name.'</td></tr>
	<tr><td colspan="7">Mã số thuế: '.$tax.'</td></tr>
	<tr><td colspan="7" height="11mm">Địa chỉ: '.$address.'</td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="2"></td><td colspan="3" align="left">'.$form_print.'</td><td colspan="2"></td></tr>
	<tr><td colspan="2"></td><td colspan="3" align="left">'.$serial_print.'</td><td colspan="2"></td></tr>
	<tr><td colspan="2"></td><td colspan="3" align="left">'.$space2.'Quyển số: '.$i.'</td><td colspan="2"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td></td><td colspan="2" align="left">Từ số: '.$sotruoc1.'</td><td colspan="3" align="right">Đến số: '.$sosau1.'</td><td></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	</table>';
	$pdf->writeHTML($html, true, false, false, false, 'C');	
	$html = '&nbsp;&nbsp;&nbsp;<table border="0" style="height:140mm;width:160mm">
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7" height="11mm">'.$name.'</td></tr>
	<tr><td colspan="7">Mã số thuế: '.$tax.'</td></tr>
	<tr><td colspan="7" height="11mm">Địa chỉ: '.$address.'</td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td colspan="2"></td><td colspan="3" align="left">'.$form_print.'</td><td colspan="2"></td></tr>
	<tr><td colspan="2"></td><td colspan="3" align="left">'.$serial_print.'</td><td colspan="2"></td></tr>
	<tr><td colspan="2"></td><td colspan="3" align="left">'.$space2.'Quyển số: '.$j.'</td><td colspan="2"></td></tr>
	<tr><td colspan="7"></td></tr>
	<tr><td></td><td colspan="2" align="left">Từ số: '.$sotruoc2.'</td><td colspan="3" align="right">Đến số: '.$sosau2.'</td><td></td></tr>
	</table>';
	$pdf->writeHTML($html, true, false, false, false, 'C');	
}
?>
